#pragma once

#include "index/index.h"
#include "util/hashmap/hash_map.h"
#include "util/status.h"

namespace hawking {
namespace indexlib {

class DeletionMapIndexer {
public:
    DeletionMapIndexer() = default;
    ~DeletionMapIndexer() = default;

    Status Init();

    void Delete(DocId doc_id) {
        delete_set_->Insert(doc_id);
    }

    uint32_t GetDeletedDocCount() const {
        return delete_set_->Size();
    }

    bool IsDeleted(DocId doc_id) const {
        return delete_set_->Exist(doc_id);
    }

    void Filter(SegmentContext* segment_ctx) const;

private:
    std::unique_ptr<HashSet<DocId>> delete_set_;
};

}
}